/**
 * Created by yu on 16/9/5.
 * 跨域
 */
var http = require('http');
var fs = require('fs');
var users = [];
var server = http.createServer(function(req,res){
    var str = '';
    //设置响应头,即允许哪个来源访问当前服务器
    res.setHeader('Access-Control-Allow-Origin','http://localhost:63342');
    req.on('data',function(data){

        str += data;
    })
    req.on('end',function(){

        var user = JSON.parse(str);
        users.push(user);
    })
    res.end(JSON.stringify(users));

})
server.listen(8080,'localhost');

